package net.monare.mifss.evn;

import net.monare.mifss.MifssAdminMainUI;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;

import com.vaadin.navigator.Navigator;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.UI;

public class LogoutListener implements ClickListener {

	private static final long serialVersionUID = 762854322502855379L;

	@Override
	public void buttonClick(ClickEvent clickEvent) {
		
		SecurityContextHolder.clearContext();
        //SecurityContext securityContext = ((MifssAdminMainUI) UI.getCurrent()).getSecurityContext();

		UI.getCurrent().close();

		Navigator navigator = UI.getCurrent().getNavigator();
		navigator.navigateTo("logout");
		
	}

}
